<template>
  <el-table :data="tableList" style="width: 100%">
    <el-table-column label="序号" width="80">
      <template slot-scope="scope">
        <span>{{ (pageIndex - 1) * 10 + scope.$index + 1 }}</span>
      </template>
    </el-table-column>
    <el-table-column prop="taskCode" label="工单编号" width="132">
    </el-table-column>
    <el-table-column prop="innerCode" label="设备编号" width="131">
    </el-table-column>
    <el-table-column  label="工单类型" width="131">
      <template slot-scope="scope">
        <span>{{ scope.row.taskType&&scope.row.taskType.typeName||"补货工单" }}</span>
      </template>
    </el-table-column>
    <el-table-column label="工单方式" width="131">
      <template slot-scope="scope">
        <span>{{ scope.row.createType ? "手动" : "自动" }}</span>
      </template>
    </el-table-column>
    <el-table-column
      prop="taskStatusTypeEntity.statusName"
      label="工单状态"
      width="131"
    >
    </el-table-column>
    <el-table-column
      prop="userName"
      label="运营人员"
      width="131"
    ></el-table-column>
    <el-table-column label="创建日期" width="160">
      <template slot-scope="scope">
        <span>{{ disponseTime(scope.row.createTime) }}</span>
      </template>
    </el-table-column>
    <el-table-column label="操作" width="100">
      <template slot-scope="scope">
        <span class="blue" @click="$emit('look', scope.row.taskId)"
          >查看详情</span
        >
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  props: {
    tableList: {
      required: true,
      type: Array
    },
    pageIndex: {
      required: true,
      type: Number
    }
  },
  methods: {
    // 处理时间格式
    disponseTime (str = '') {
      return str.replace(/T/, ' ').replace(/-/g, '.')
    }
  }
}
</script>
<style lang="scss" scoped>
.el-table {
  width: 100%;
  ::v-deep .el-table__header-wrapper {
    .el-table__header {
      width: 100% !important;
      thead tr {
        border-radius: 5px;
        overflow: hidden;
        th {
          background-color: #f3f6f8;
          color: #666;
          border: 0;
        }
      }
    }
  }
  ::v-deep .el-table__body-wrapper {
    .el-table__body {
      width: 100%  !important;
      tbody tr td {
        border: 0;
      }
    }
  }
}
</style>
